Repository navigation
Conversation
…Rect setBounds read the window's current bounds through nativeapi before every call, even when the caller passed a full Rect and none of the current values were used. Only read them when position or size is partial. Adds debugBindWindow (same hook as the sibling legacy PRs) so the bridge can be tested against a Dart fake window.
mockturtl
added a commit
to mockturtl/window_manager
that referenced
this pull request
Nov 17, 2026
setPosition called setBounds(null, position: ...). setBounds reads window.bounds, replaces the position and writes the whole rectangle back. After a setSize call, the window manager applies the new size a few milliseconds later. Until then, window.bounds returns the old size, so setBounds wrote the old size back and cancelled the new one. On Linux (X11), this broke setAlignment, setPosition and center after setSize. When animate is false, move only the position. The animated path does not change. Add WindowManager.debugTarget (visible for testing), so that a test can replace the native window with a fake. Add tests for setPosition. With the old code, the three tests for animate false fail. With the fix, all five pass. debugTarget is a temporary test hook. The open PR leanflutter#607 adds debugBindWindow(window) for the same job. When that PR merges, the tests will use debugBindWindow and debugTarget will go away. The open PR leanflutter#606 also changes the _target getter, so a conflict with debugTarget is likely. Checked by hand on Linux (X11, Cinnamon 6.6.9 with Muffin 6.6.3). Not tested on macOS, Windows or Wayland. Refs libnativeapi/nativeapi#37 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mockturtl
added a commit
to mockturtl/window_manager
that referenced
this pull request
Nov 17, 2026
Replace the temporary WindowManager.debugTarget setter with debugBindWindow(window). The open PR leanflutter#607 adds debugBindWindow for the same job. This commit needs leanflutter#607. Without leanflutter#607, the tests do not compile. Merge leanflutter#607 before this commit. The previous commit stands alone, and its tests pass with debugTarget. The tests check the same behavior as before. I ran them with leanflutter#607 applied on top of this branch. The five tests of legacy_set_position_test.dart pass, and so do the five tests of leanflutter#607. With setPosition reverted, exactly the three tests for animate false fail. Tested on Linux (X11) only. Refs libnativeapi/nativeapi#37 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WindowManager.setBoundsin the 0.5.x-compatible legacy API always read the window's current bounds through nativeapi (a synchronous FFI call) before applying new ones. It did this even when the caller passed a fullRect, so none of the values it read were used. Apps that restore or move the window with a fullRectpay for that extra native round trip on every call.Change
boundsis null andpositionand/orsizegive a partial update.Rectstill takes precedence overposition/size,animatestill triesanimateBoundsfirst and falls back to a plain set, and an empty request is still a no-op.@visibleForTesting debugBindWindowhook so the bridge can be tested against a Dart fake window. The hunk is identical to the one in fix(legacy): report show/hide and fix restore tracking #602, fix(legacy): keep the event bridge compiling when nativeapi adds events #604 and fix(legacy): show taskbar progress and badge on this app's window #605, so those PRs merge with this one without conflicts.Tests
New
test/legacy_set_bounds_test.dart, with its own fakenativeapi.Windowthat counts bounds reads. It checks that:Rectis applied with no bounds read;Rectwins overposition/size;animate: truefalls back to a plain set;dart format,flutter analyze(package and example) andflutter testall pass locally.